<%--
 *  File:    OrgSolutionType.jsp
 *  @Author: Kent Zhong 
 *  Date:    2002/05/07
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
 

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom-tag.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.OrgSolutionType");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "IMG";
  	String strTableName = "ovorg";
	String privilegeCode = "Z0803,L801";
  	
  	//get current userinfo
  	HashMap CurUserInfo = (HashMap)session.getAttribute("userinfo");
  	cat.debug("The userinfo is :"+CurUserInfo);
  	cat.info("enter my page");
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<html>
<head>
<title>OrgSolutionType</title>
<PageFlow:CheckPageFlow pageName="orgsolutionsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../js/FuncLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script language="JavaScript" >
function orginit(oid,id,initflag)
{
	window.open("OrgSolutionInitPop.jsp?<%= OvalTools.randomURL() %>&orgid="+id+"&initflag=" + initflag, "newwindow", "height=200, width=550,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
}

    
    
    function page_summary(actionvalue,orderbyname)
	{
	  var editform = summaryPrepare(orgsolutiontypeform,actionvalue,orderbyname);
	  editform.action = "OrgSolutionType.jsp?<%= OvalTools.randomURL() %>";
	  editform.target = "_self";
	  isRunning = true;
	  editform.submit();  
	}
    
    function page_save()
    {
        document.orgsolutiontypeform.actionname.value="save";
        document.orgsolutiontypeform.target="_self";
        isRunning = true;
        document.orgsolutiontypeform.submit();
    }

    function page_init(an,oid,id,initflag)
    {
      
/* maggie_20061025, needn't check
      if (initflag.charAt(0)=='0') 
      {
        alert('<%= message.getMessageDesc("J_ORG_NO_ADMIN") %>');
        return;        
      }

      if (initflag.charAt(1)=='0') 
      {
        alert('<%= message.getMessageDesc("J_ORG_NO_AUTHORITY") %>');
        return;        
      }

      if (initflag.charAt(2)=='0') 
      {
        alert('<%= message.getMessageDesc("J_ORG_NO_ORGOPTION") %>');
        return;        
      }
*/
      
      if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE") %>'))
        return;
      document.orgsolutiontypeform.orgid.value = id;
      document.orgsolutiontypeform.ownerorgid.value = oid;
      document.orgsolutiontypeform.actiontype.value = an;
      
      document.orgsolutiontypeform.actionname.value="init";
      document.orgsolutiontypeform.target="_self";
      isRunning = true;
      document.orgsolutiontypeform.submit();
    }

	function page_cancel()
	{ 
	   document.location.href= self.location + "";
	}
function refreshWindow()
{
  	self.location.href = "OrgSolutionType.jsp?<%= OvalTools.randomURL() %>" ;
}	
	

<%--[SCRIPT]    [SCRIPT]--%>
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="orgsolutiontypeform" method="post" action="../Dispatcher"  target="_parent">
    <input type="hidden" name="pagename" value="orgsolutionsummary">
    <input type="hidden" name="actionname">
    <input type="hidden" name="languagecode" value="<%= strLanguageCode %>">
    <input type="hidden" name="orgid">
    <input type="hidden" name="ownerorgid">
    <input type="hidden" name="actiontype">
<%@ include file="/inc/PageLocation.inc" %>
<%
    Vector allorgsolu=(Vector)pageContext.getAttribute("allorgsolu");
    if(allorgsolu==null)
    {
        allorgsolu=new Vector();
    }
    Vector orgsummary=(Vector)pageContext.getAttribute("orgsummary");
    if(orgsummary==null)
    {
        orgsummary=new Vector();
    }
    cat.debug("orgsummary is :"+orgsummary);
    cat.debug("allorgsolu is :"+allorgsolu);
    
%>
<table width="100%" cellspacing="0">
  <tr> 
    <td class="summary_top"></td>
  </tr>
  <%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>
</table>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
  <tr> 
    <td> 
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
      
          <tr class="deepblue-left" > 
            <td class="title_center" width="60"><a href="javascript:page_summary('orderby','orgcode')"><%=label.getLabelName("L_OrgCode")%></a></td>
            <td class="title_center" width="60"><a href="javascript:page_summary('orderby','orgid')"><%=label.getLabelName("L_OrgID")%></a></td>
            <td class="title_center" 			 ><a href="javascript:page_summary('orderby','shortname')"><%=label.getLabelName("L_OrgName")%> </a></td>
            <td class="title_center" 	width="120"		 ><a href="javascript:page_summary('orderby','parentorgname')"><%=label.getLabelName("L_ParentOrg")%></a></td>
            <td class="title_center" width="90"		 ><a href="javascript:page_summary('orderby','pccodename')"><%=label.getLabelName("L_SCM Role")%></a></td>
            <td class="title_center" width="80" ><a href="javascript:page_summary('orderby','solutiontypename')"><%=label.getLabelName("L_SolutionType")%></a></td>
            <td class="title_center" width="65" ><%=label.getLabelName("L_OrgInit")%></td>
            <td class="title_center" width="30" >&nbsp;</td>
            <td class="title_center" width="30" >&nbsp;</td>
            <td class="title_center" width="30" >&nbsp;</td>
          </tr>
          <%
            int i=0;
            String strClassType="";
          %>
          <logic:iterate id="orgsummaryitem" collection="<%= orgsummary %>">
          <%
            if(i%2 == 1)
            {
              strClassType = "td-listrom";
            }else{                    
              strClassType = "none";
            }
            i++;
            HashMap hashTemp=(HashMap)pageContext.getAttribute("orgsummaryitem");
            if(hashTemp==null)
            {
                hashTemp=new HashMap();
            }
            Integer oSolutionType=(Integer)hashTemp.get("solutiontype");
            if(oSolutionType==null)
            {
                oSolutionType=new Integer(-1);
            }
            int nSolutionType=oSolutionType.intValue();
            cat.debug("hashTemp is:"+hashTemp);
            cat.debug("nSolutionType is:"+nSolutionType);
          %>
          <input type=hidden name=orgid<%=JspHelper.filterNull(i-1)%> value='<oval:write name="orgsummaryitem" property="orgid" />'>
          
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>"> 
            <td >&nbsp;<oval:write name="orgsummaryitem" property="orgcode" /></td>
            <td >&nbsp;<oval:write name="orgsummaryitem" property="orgid" /></td>
            <td >&nbsp;<oval:write name="orgsummaryitem" property="shortname" /></td>
            <td >&nbsp;<oval:write name="orgsummaryitem" property="parentorgname" /></td>
            <td >&nbsp;<oval:write name="orgsummaryitem" property="pccodename" /></td>            
            <td > 
              <select name="solutiontype<%=JspHelper.filterNull(i-1)%>">
                <%--option value=''>------</option--%>
                <logic:iterate id="allorgsoluitem" collection="<%= allorgsolu %>">
                <%
                    HashMap hmTemp=(HashMap)pageContext.getAttribute("allorgsoluitem");
                    if(hmTemp==null)
                    {
                        hmTemp=new HashMap();
                    }
                    Integer oType=(Integer)hmTemp.get("value");
                    if(oType==null)
                    {
                        oType=new Integer(-1);
                    }
                    int nType=oType.intValue();
                    String strSelected="";
                    if(nType==nSolutionType)
                        strSelected="Selected";
                    cat.debug("hmTemp is:"+hmTemp);
                    cat.debug("nType is:"+nType);     
                %>
                    <option value='<oval:write name="allorgsoluitem" property="value" />' <%=JspHelper.filterNull(strSelected)%>><oval:write name="allorgsoluitem" property="valuename" /></option>
                </logic:iterate>
              </select>
              </td>
              <td class="td_center">
              <% if(hashTemp.get("solutiontype") != null && (hashTemp.get("solutiontype").toString().equals("1") || hashTemp.get("solutiontype").toString().equals("2")) ){ %>
              <a onclick="orginit('<%=JspHelper.filterNull( hashTemp.get("ownerorgid") )%>','<%=JspHelper.filterNull( hashTemp.get("orgid") )%>','<%=JspHelper.filterNull( hashTemp.get("initflag") )%>')"><custom:button type="3" label="L_Init" imgsrc="init.gif" border="0"/></a>
              <%}else{%>
              &nbsp;
              <%}%>
              </td>              
              <td class="td_center">
              <% if(hashTemp.get("solutiontype") != null && hashTemp.get("solutiontype").toString().equals("2")){ %>
              <a onclick="page_init('init','<%=JspHelper.filterNull( hashTemp.get("ownerorgid") )%>','<%=JspHelper.filterNull( hashTemp.get("orgid") )%>','<%=JspHelper.filterNull( hashTemp.get("initflag") )%>')"><custom:button type="3" label="L_Init" imgsrc="init.gif" border="0"/></a>
              <%}else{%>
              &nbsp;
              <%}%>
              </td>
              <td class="td_center">
              <% if(hashTemp.get("solutiontype") != null && (hashTemp.get("solutiontype").toString().equals("1") || hashTemp.get("solutiontype").toString().equals("2")) ){ %>
              <a onclick="page_init('inititem','<%=JspHelper.filterNull( hashTemp.get("ownerorgid") )%>','<%=JspHelper.filterNull( hashTemp.get("orgid") )%>','<%=JspHelper.filterNull( hashTemp.get("initflag") )%>')"><custom:button type="3" label="L_Catalog" imgsrc="catalog.gif" border="0"/></a>
              <%}else{%>
              &nbsp;
              <%}%>
              </td>
              <td class="td_center">
              <% if(hashTemp.get("solutiontype") != null && (hashTemp.get("solutiontype").toString().equals("1") || hashTemp.get("solutiontype").toString().equals("2")) ){ %>
              <a onclick="page_init('initprice','<%=JspHelper.filterNull( hashTemp.get("ownerorgid") )%>','<%=JspHelper.filterNull( hashTemp.get("orgid") )%>','<%=JspHelper.filterNull( hashTemp.get("initflag") )%>')"><custom:button type="3" label="L_Price" imgsrc="price.gif" border="0"/></a>
              <%}else{%>
              &nbsp;
              <%}%>
              </td>
          
          </tr>
          </logic:iterate>
          <input type=hidden name=numrows value='<%=JspHelper.filterNull(i)%>'>
          <tr align="right"> 
            <td colspan="12"> 
              <table width="100%" cellspacing="0" border="0">
                <tr> 
                 <%@ include file="/inc/SummaryAction.inc" %>
                </tr>
              </table>
            </td>
          </tr>
       
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top" ></td>
        </tr>
        <tr> 
          <td class="td_center">
          <a onclick="page_save();"><custom:button type="1" label="L_Finish" imgsrc="finish.gif" border="0" style="width:60"/></a>
          <a onclick="page_cancel();"><custom:button type="1" label="L_Cancel" imgsrc="cancel.gif" border="0" style="width:60"/></a></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
 </form>
</body>
</html>


